<template>
  <div class="hello">
    <el-table
      :data="tableData"
      border
      style="width: 100%">
      <el-table-column
        prop="id"
        label="Id"
        width="180">
      </el-table-column>
      <el-table-column
        prop="name"
        label="姓名"
        width="180">
      </el-table-column>
      <el-table-column
        prop="phone"
        label="电话"
        width="180">
      </el-table-column>
      <el-table-column
        prop="email"
        label="邮箱"
        width="180">
      </el-table-column>
      <el-table-column
        prop="createTime"
        label="创建时间"
        width="180">
      </el-table-column>
      <el-table-column
        prop="address"
        label="地址">
      </el-table-column>
    </el-table>
    <el-pagination
      background
      layout="sizes, prev, pager, next"
      align="right"
      :total="1000"
      :current-page="currentPage"
      :page-size="pageSize"
      :page-sizes="[5, 10, 15, 20]">

    </el-pagination>
  </div>
</template>

<script>
// axios
// import axios from "axios";

export default {
  name: 'HelloWorld',
  data() {
    return {
      tableData: [],
      currentPage: 2,
      pageSize: 5
    }
  },
  mounted() {
    this.$http.post("https://www.fastmock.site/mock/bc45fd54500f86c6898642a282475116/pethmoe/user/list", {"currentPage": 1, "pageSize": "5"}).then(result => {
      // then是接口请求成功的返回，result是接口返回的参数化
      // 将resul中的data.data数据赋值给tableData
      this.tableData = result.data.data
    }).catch(reason => {
      this.$message.error('系统繁忙，请重试！');
      console.log(result);
    })
  }
}
</script>


<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
